package com.java.util.interceptor;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {
	
	@Override
	public void addInterceptors(InterceptorRegistry registry) {

		registry.addInterceptor(new AdminInterceptor()).addPathPatterns("/admin/**")
		.excludePathPatterns("/admin/login", "/admin/logon", "/admin/logout");
		
		registry.addInterceptor(new StudentInterceptor()).addPathPatterns("/student/**")
		.excludePathPatterns("/student/auth", "/student/login", "/student/logon", "/student/register", "/student/unauth");
		
		registry.addInterceptor(new TeacherInterceptor()).addPathPatterns("/teacher/**")
		.excludePathPatterns("/teacher/auth", "/teacher/login", "/teacher/logon", "/teacher/register", "/teacher/unauth");
		
		registry.addInterceptor(new GroupInterceptor()).addPathPatterns("/group/**")
		.excludePathPatterns("/group/auth", "/group/login", "/group/logon");
	}
}